home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
08 System Utilities
/
DISK.BIN
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
6KB
|
214 lines
5 POKE 49152,10:IF PEEK(49152)<>10 THEN C0=1:GOTO6:C0=2
6 DIM DOS%(65)
7 FR=FRE(0):IF FR<0 THEN FR=FR+65536
8 S=(FR-400)/2:M2=INT(S/256)+1
9 DIM TEMP%(S)
10 GOSUB1300
25 PRINT""
50 PRINTTAB(5)"[159]1. DISK DIRECTORY"
60 PRINTTAB(5)"2. FORMAT NEW DISK"
70 PRINTTAB(5)"3. INITIALIZE DISK"
80 PRINTTAB(5)"4. COPY FILE ON SAME DISK"
85 PRINTTAB(5)"5. COPY FILE ON NEW DISK"
88 PRINTTAB(5)"6. COPY BOTH DOS WEDGE PROGRAMS"
90 PRINTTAB(5)"7. RENAME FILE"
100 PRINTTAB(5)"8. ERASE FILE(S)"
110 PRINTTAB(5)"9. VALIDATE FILES"
120 PRINTTAB(4)"10. WRITE DISK MANAGER"
130 PRINTTAB(4)"11. ERROR STATUS"
140 PRINTTAB(4)"12. EXIT TO BASIC":PRINT
170 GOSUB1400
200 ON VAL(C$) GOSUB 250,300,350,400,800,1200,450,500,550,600,650,700
210 GOTO 10
250 REM***DISPLAY DIRECTORY***
251 PRINT"[147][150]"
252 OPEN 1,8,0,"$"
253 GET #1,A$,B$
254 GET#1,A$,B$
256 GET #1,A$,B$
258 C=0:IF A$<>""THEN C=ASC(A$)
260 IF B$<>""THEN C=C+ ASC(B$)*256
262 PRINT MID$(STR$(C),2);TAB(4);
264 GET#1,B$:IF ST<>0THEN 282
266 IF B$<> CHR$(34) THEN 264
268 GET #1,B$:IF B$<> CHR$(34) THEN PRINTB$;:GOTO 268
270 GET #1,B$:IF B$=CHR$(32) THEN 270
272 PRINT TAB(22);:C$=""
274 C$=C$+B$:GET #1,B$:IF B$<>"" THEN 274
276 PRINT"[159]"LEFT$(C$,3)
280 IF ST=0 THEN 254
282 PRINT" BLOCKS FREE "
284 CLOSE 1:PRINT:PRINT:PRINT"[158]HIT ANY KEY TO RETURN"
290 GET X$:IFX$=""THEN290
295 RETURN
300 REM***FORMAT (NEW)***DISK
301 PRINT"[147][150]"
305 PRINT"INSERT DISK TO BE":PRINT"FORMATTED.":PRINT
310 PRINT"INPUT DISK NAME":INPUT DISK$
320 PRINT:PRINT"INPUT TWO CHAR. CODE":INPUT EXT$
325 MACRO$="N0:"+DISK$+","+EXT$
330 OPEN 15,8,15,MACRO$
340 CLOSE 15:MACRO$="":RETURN
350 REM***INITIALIZE DISK***
355 PRINT"[147][150]"
360 PRINT"INSERT DISK TO BE":PRINT"INITIALIZED.":PRINT
370 PRINT"HIT <RETURN> TO":PRINT"INITIALIZE":INPUT X$
380 OPEN 15,8,15,"I"
390 CLOSE 15:RETURN
400 REM***COPY FILE ON SAME DISK***
405 PRINT"[147][154]":PRINT:PRINT
410 PRINT"INPUT SOURCE FILE NAME":INPUT DISK$
420 PRINT:PRINT"INPUT NEW FILE NAME":INPUT NWS$
425 MACRO$="C:"+NWS$+"="+DISK$
430 OPEN 15,8,15,MACRO$
440 CLOSE 15:MACRO$="":RETURN
450 REM***RENAME FILE***
455 PRINT"[147][153]":PRINT
460 PRINT"INPUT OLD FILE NAME":INPUT DISK$
470 PRINT:PRINT"INPUT NEW FILE NAME":INPUT NWS$
475 MACRO$="R0:"+NWS$+"="+DISK$
480 OPEN 15,8,15,MACRO$
490 CLOSE 15:MACRO$="":RETURN
500 REM*** ERASE FILE***
505 PRINT"[147][150]":PRINT:PRINT
510 PRINT"INPUT FILE NAME(S) TO DELETE":INPUT DISK$
520 PRINT:PRINT:PRINT"HIT ANY KEY TO DELETE"
525 GET X$:IF X$="" THEN 525
530 MACRO$="S0:"+DISK$
535 OPEN 15,8,15,MACRO$
540 CLOSE 15:MACRO$="":RETURN
550 REM***VALIDATE FILES***
555 PRINT"[147][150]":PRINT:PRINT
560 PRINT"WARNING:OPEN FILES ":PRINT"WILL BE DELETED"
570 PRINT:PRINT:PRINT"HIT ANY KEY TO VALIDATE"
575 GET X$: IF X$=""THEN575
580 OPEN 1,8,15,"V"
590 CLOSE 1:RETURN
600 REM**WRITE DISKMANAGER PROGRAM**
605 PRINT"[147][154]":PRINT:PRINT
610 PRINT"INSERT DISK TO BE WRITTEN TO.":PRINT
620 PRINT:PRINT:PRINT"HIT ANY KEY TO WRITE DISK MANAGER"
622 GET X$:IF X$=""THEN 622
625 OPEN 1,8,15
630 SAVE"@0:DISKMANAGER",8
635 CLOSE 1
640 RETURN
650 REM***DISPLAY ERROR STATUS***
655 OPEN15,8,15
660 INPUT#15,A$,B$,C$,D$
670 PRINT"[147][158]":PRINT:PRINT
680 PRINT"ERROR STATUS: "B$:PRINT:PRINT"ERROR NUMBER: "A$
690 PRINT:PRINT:PRINT"HIT ANY KEY TO RETURN"
695 GET X$:IF X$=""THEN 695
697 CLOSE 15:RETURN
700 REM***RETURN TO BASIC OR MENU ***
705 PRINT"[147][159]"
710 PRINTTAB(7)"F1[146] - RETURN TO MAIN MENU"
715 PRINTTAB(7)"F3[146] - RETURN TO DISKMANAGER"
720 PRINTTAB(7)"F5[146] - EXIT TO BASIC"
725 GETA$:IFA$=""THEN725
727 IFA$=CHR$(133)THEN63000
728 IFA$=CHR$(134)THEN10
729 IFA$=CHR$(135)THEN735
730 GOTO725
735 POKE53280,11
737 PRINT"[147][150]* DISKMANAGER PROGRAM IS STILL RESIDENT*[146][159]"
740 END
800 REM***COPY FILE ON NEW DISK***
801 PRINT"[147][154]"
802 CLOSE 15
803 MAX=INT(S/256)
804 PRINT " MAXIMUM SIZE OF FILE WHICH CAN BE COPIED IS"MAX" BLOCKS":PRINT
806 IF MAX>=M2 THEN GOTO 809
807 PRINT " FOR MAXIMUM COPY SIZE OF "M2" BLOCKS,";
808 PRINT "TURN COMPUTER OFF/ON AND RELOAD PROG."
809 PRINT:PRINT" READ/WRITE RATE IS APPROXIMATELY 6 BLOCKS/MINUTE"
810 PRINT:PRINT"INPUT NAME OF FILE TO BE COPIED"
820 INPUT FILE$
830 PRINT:PRINT" INPUT FILE TYPE:"
840 PRINT " P PROGRAM"
860 PRINT " U USER"
870 PRINT " R RELATIVE"
880 INPUT TYPE$
890 PRINT:PRINT "INSERT SOURCE DISK AND PRESS <RETURN>"
900 GET W$:IF W$=""THEN GOTO 900
910 GOSUB 1000:REM READ FILE INTO TEMP
920 PRINT:PRINT "INSERT DESTINATION DISK AND PRESS <RET>"
930 GET W$:IF W$=" " THEN GOTO 930
940 GOSUB 1050:REM WRITE FILE FROM TEMP$
950 PRINT:PRINT "MAKE ANOTHER COPY";:INPUTW$
960 IF LEFT$(W$,1)="Y" THEN GOTO 920
970 GOTO 1100
980 REM-CHECK FOR GOOD OPEN
985 INPUT#15,A$,B$,C$,D$
990 IF VAL(A$)=0 THEN RETURN
995 PRINT A$,B$,C$,D$:CLOSE 15:STOP
1000 REM - READ FILE INTO TEMP%
1002 I=1
1004 OPEN 15,8,15
1006 OPEN 5,8,5,"0:"+FILE$+","+TYPE$+",R"
1008 GOSUB 980
1009 PRINT " NOW READING..."
1010 GET#5,A$
1012 TEMP%(I)=ASC(A$+CHR$(0))
1014 I=I+1
1016 IF ST=0 THEN 1010
1018 PRINT:PRINT "FILE=? ";FILE$,"ST=";ST,"BYTES=";I:CLOSE 5:CLOSE 15
1020 RETURN
1050 REM - WRITE FILE FROM TEMP%
1052 OPEN 15,8,15
1054 OPEN 5,8,5,"0:"+FILE$+","+TYPE$+",W"
1056 GOSUB 980
1057 PRINT " NOW WRITING..."
1058 J=1
1060 PRINT#5,CHR$(TEMP%(J));
1062 J=J+1
1064 IF J<I THEN 1060
1066 PRINT:PRINT "FILE= ";FILE$,"BYTES=";J:CLOSE 5:CLOSE15
1068 RETURN
1100 RETURN
1200 REM***COPY BOTH DOS PROGRAMS***
1205 PRINT"[147][153]":PRINT "INSERT SOURCE DISK WITH WEDGE AND/OR DOS";
1210 PRINT"PROGRAM(S) AND PRESS <RETURN>"
1215 GET W$:IF W$=""THEN GOTO 1215
1218 TYPE$="P"
1219 IF C0=1THEN FILE$="VIC-20 WEDGE":GOTO 1235
1220 FILE$="C-64 WEDGE":GOSUB 1000
1225 FOR C=1 TO 64:DOS%(C)=TEMP%(C):NEXT C:REM MOVE C-64 WEDGE TO SMALL BUFFER
1230 FILE$="DOS 5.1"
1235 GOSUB 1000:PRINT:PRINT "INSERT DESTINATION DISK AND PRESS <RET>"
1240 GET W$:IF W$=""THENGOTO 1240
1245 GOSUB 1050:IF C0=1 THEN RETURN
1250 FOR C=1 TO 64:TEMP%(C)=DOS%(C):NEXT C
1255 FILE$="C-64 WEDGE":I=64:GOSUB 1050:REM WRITE C-64 WEDGE
1290 RETURN
1300 POKE53280,0:POKE53281,0
1302 PRINT"[147][154] [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
1304 PRINT" [221][158] D I S K M A N A G E R [146][154][221]"
1306 FORT=1TO20
1308 PRINT"[154] [221] [221]"
1310 NEXT
1311 PRINT" [221][158] P L E A S E S E L E C T [146][154][221]"
1312 PRINT" [202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
1315 RETURN
1400 T%=20:LS%=2:PRINT"[150]"
1401 GETC$:IFC$=""THEN1401
1410 IFASC(C$)<49ORASC(C$)>57THEN1401
1420 PRINTTAB(T%-1)"[145]";C$
1430 GETY$:IFY$=""THEN1430
1440 IFY$=CHR$(13)THENRETURN
1450 IFASC(Y$)=20THENPRINTTAB(T%+LEN(C$)-2)"[145] ":GOTO1490
1460 IFASC(Y$)<48ORASC(Y$)>57THEN1430
1470 IFLEN(C$)=LS%THEN1430
1480 C$=C$+Y$:PRINTTAB(T%-1)"[145]";C$:GOTO1430
1490 IFLEN(C$)=0THEN1401
1500 PRINTTAB(T%+LEN(C$)-2)"[145]":C$=LEFT$(C$,LEN(C$)-1):GOTO1430
63000 POKE53280,0:POKE53281,0
63010 PRINT"[147][144]LOAD"CHR$(34)" MENU"CHR$(34)",8"
63020 POKE636,0:POKE64,0:POKE48,8:POKE52,160
63030 POKE54,0:POKE56,160:POKE57,0:POKE58,255
63040 POKE62,0
63050 PRINT"RUN"
63060 PRINT""TAB(14)"[154]LOADING....[144]":POKE198,3
63070 POKE631,19:POKE632,13:POKE633,13:POKE59,0:POKE60,0:NEW